chore: add Pyrameter test-shape enforcement#1358
Conversation
|
Ready to review/merge 👍 |
|
synced latest develop, I can rebase if needed 👍 |
|
@samsonasik How were these thresholds determined, and what is the rationale behind choosing these specific percentages? Could you please rebase the branch instead of using a merge commit? We'd prefer to keep the history linear. |
5175689 to
eb176ac
Compare
|
@datamweb I've rebased it. For classification is per class/function usage with allow excluding if some part is more weight than other, on this repo,
Ideally, unit test minimal should be the greater, and functional/integration will less, but on this repo use case, it seems functional/integration test is more than unit, so the pyramid is currently inverted. I use existing condition as baseline, with unit minimal to 40%, but to ensure functional and integration test will not continue growing, I set maximum to them as 10% and 50%. |
|
According to the described classification, tests using Since Pyrameter scans the concrete test file, these tests appear to be classified as unit rather than functional. Until the classification is reliable, I would prefer not to enable |
|
@michalsn sure, I've updated to mark Now, it already pyramid structure 👍 =========
Pyrameter
=========
Shape: Healthy Pyramid
Result: Passed ✓
▲ E2E ✓
▄▄▄▄▄ Functional ✓
▄▄▄▄▄▄▄▄▄ Integration ✓
▄▄▄▄▄▄▄▄▄▄▄▄▄ Unit ✓
+=============+=======+========+============+
| KIND | TESTS | ACTUAL | TARGET |
+=============+=======+========+============+
| Unit | 277 | 44.8% | >= 44.0% ✓ |
+-------------+-------+--------+------------+
| Functional | 97 | 15.7% | <= 16.0% ✓ |
+-------------+-------+--------+------------+
| Integration | 244 | 39.5% | <= 40.0% ✓ |
+-------------+-------+--------+------------+
| E2E | 0 | 0.0% | <= 0.0% ✓ |
+-------------+-------+--------+------------+
Total: 618 tests
Your test pyramid target passed. |
michalsn
left a comment
There was a problem hiding this comment.
@samsonasik Thanks.
I think these limits are fitted too closely to our current values. Maybe we could start with something like: 40 / 20 / 50?
If we agree on the proposed thresholds, we should bring back failOnViolation(). Without it, this is report-only, and someone would need to notice any violation in the CI logs, so this PR would no longer enforce anything.
…specific lang test suite
50a11b9 to
4c0977e
Compare
|
@michalsn sure, I've applied:
The result is now like below: =========
Pyrameter
=========
Shape: Healthy Pyramid
Result: Passed ✓
▲ E2E ✓
▄▄▄▄▄ Functional ✓
▄▄▄▄▄▄▄▄▄ Integration ✓
▄▄▄▄▄▄▄▄▄▄▄▄▄ Unit ✓
+=============+=======+========+============+
| KIND | TESTS | ACTUAL | TARGET |
+=============+=======+========+============+
| Unit | 277 | 44.8% | >= 40.0% ✓ |
+-------------+-------+--------+------------+
| Functional | 97 | 15.7% | <= 20.0% ✓ |
+-------------+-------+--------+------------+
| Integration | 244 | 39.5% | <= 50.0% ✓ |
+-------------+-------+--------+------------+
| E2E | 0 | 0.0% | <= 0.0% ✓ |
+-------------+-------+--------+------------+
Total: 618 tests
Your test pyramid target passed. |
michalsn
left a comment
There was a problem hiding this comment.
Thanks. Since this introduces a new dependency, I'd like to wait for at least one more approval before merging.
Description
This PR adds
Pyrameterphpunit extension:https://github.com/boundwize/pyrameter
Pyrameter classifies executed tests as unit, functional, integration, or e2e based on the code they use, then compares the totals with your target shape.
Per current tests, here the target limit defined:
Defines target limits:
and get output
Checklist: